iOS 6 Application Development For Dummies by Goldstein Neal & Wilson Dave

iOS 6 Application Development For Dummies by Goldstein Neal & Wilson Dave

Author:Goldstein, Neal & Wilson, Dave [Goldstein, Neal]
Language: eng
Format: mobi
Publisher: For Dummies
Published: 2013-01-09T16:00:00+00:00


Figure 9-10: The Target-Action mechanism.

You set a control’s action and target using Interface Builder. You get to specify what method — in which object — should respond to a control without having to write any code.

You can also change the target and action dynamically by sending the control or its cell setTarget: and setAction: messages.

Action methods have a certain signature (format, in other words):

- (IBAction)testDrive:(id)sender;

The type qualifier IBAction, which is used in place of the void return type, flags the declared method as an action so that Interface Builder is aware of it. (This is similar to the IBOutlet tag, used in the “Creating the outlet” section, earlier in this chapter.) And just as with outlets, you can actually make the connections in the Interface Builder editor, and Xcode will generate the necessary code for you.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.